package net.bsayiner.phoneTest;

import java.io.IOException;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;

public class ScreenTestActivity extends Activity {

	private ImageView imageView;
	private static final String testImagesPath = "images/";
	private static final String testImagesExtention = ".png";
	private String[] images = { "red", "green", "blue", "white", "black", "main", "blackRedGrad", "blackGreenGrad", "blackBlueGrad", "blackWhiteGrad", "blackRedPercent",
			"blackGreenPercent", "blackBluePercent", "blackWhitePercent", "multiple", "pixelMapping" };
	private int count;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.screen_test_layout);
		imageView = (ImageView) findViewById(R.id.imgScreenTest);
	}

	public void onImgScreenTestClick(View view) {
		if (count < images.length) {
			Bitmap testImage;
			try {
				testImage = BitmapFactory.decodeStream(getResources().getAssets().open(testImagesPath + images[count] + testImagesExtention));
				imageView.setImageBitmap(testImage);
			} catch (IOException e) {
				e.printStackTrace();
			}
			count++;
		}
		else {
			count = 0;
		}
	}
}
